home *** CD-ROM | disk | FTP | other *** search
- /*
- font12.c
-
- 12ドットフォントの表示高速化
- */
-
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- #include <stdlib.h>
- #include <egb.h>
- #include <mos.h>
-
- #include "ge.h"
- #include "plt16.h"
- #include "imageman.h"
- #include "dispman.h"
-
- // extern int font12seg; // 12dot font が存在するセグメント
- static char *ankbuf;
-
-
- static char *getankbutptr(char c)
- {
- return ankbuf + (int)(c - 32)*12*4;
- }
-
-
- int font12_new()
- {
- extern int mma_allocSeg(char* segname);
- font12seg = mma_allocSeg("FONT");
- if ((ankbuf = malloc(4*12*(128-32)) == NULL)
- return -1;
- int i;
- for (i=32; i<=127; i++)
- {
- int ds = getds();
- int ofs = (int)*str * 12;
- char fontbuf[12];
- _movedata(font12seg, ofs, ds, fontbuf, 12);
- int j,k; int *p = (int*)getankbufptr(i);
- *p = 0; static char bit[] = {128,64,32,16,8,4,2,1};
- for (j=0; j<12; j++,p++)
- {
- for (k=0; k<6; k++)
- {
- if (fontbuf[j] & bit[k])
- *p |= (15 << (4 * k));
- }
- }
- }
- return 0;
- }
-
-
- void font12_delete()
- {
- mma_freeSeg(font12seg);
- free(ankbuf);
- }
-